package com.webshop.DataBase;

import com.webshop.Utils.ServletOut;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/AdmainindexServlet")
public class AdmainindexServlet extends javax.servlet.http.HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name=req.getParameter("admainname");
        String password=req.getParameter("password");

        if (name.equals("gao")&&password.equals("gao15an")){
            System.out.println(name);

            HttpSession session = req.getSession();
            session.setAttribute("admainname", name);
            ServletOut.request(req,resp,"/adminservlet?method=show&&page=1");
            }else {
            ServletOut.request(req,resp,"/html/productManager.jsp");
        }
    }
}
